<template>

  <view class="components-list tn-safe-area-inset-bottom">

    <!-- 顶部自定义导航 -->
    <tn-nav-bar fixed>贷款详情查询</tn-nav-bar>

    <!-- 页面内容 -->
    <view :style="{paddingTop: vuex_custom_bar_height + 'px'}">
      <demo-title>
        <view class="tn-margin-top-sm">
			<tn-list-cell>
			  <view class="list-icon-text">
			    <view class="list__left">
			      <view class="list__left__text tn-color-black tn-text-bold">贷款类型</view>
			    </view>
			    <view class="list__right">
			      <view class="tn-text-sm tn-color-gray">货物抵押贷款</view>
			    </view>
			  </view>
			</tn-list-cell>
          <tn-list-cell>
            <view class="list-icon-text">
              <view class="list__left">
                <view class="list__left__text">贷款合同号</view>
              </view>
              <view class="list__right">
                <view class="tn-text-sm tn-color-gray">{{loan.loan.loanNo}}</view>
              </view>
            </view>
          </tn-list-cell>
		  <tn-list-cell>
		    <view class="list-icon-text">
		      <view class="list__left">
		        <view class="list__left__text">贷款账号</view>
		      </view>
		      <view class="list__right">
		        <view class="tn-text-sm tn-color-gray">{{loan.loan.bankCard}}</view>
		      </view>
		    </view>
		  </tn-list-cell>
		  <tn-list-cell>
		    <view class="list-icon-text">
		      <view class="list__left">
		        <view class="list__left__text">贷款状态</view>
		      </view>
		      <view class="list__right">
		        <view class="tn-text-sm tn-color-gray">正常</view>
		      </view>
		    </view>
		  </tn-list-cell>
		  <tn-list-cell>
		    <view class="list-icon-text">
		      <view class="list__left">
		        <view class="list__left__text">贷款金额</view>
		      </view>
		      <view class="list__right">
		        <view class="tn-text-sm tn-color-gray">{{loan.loan.loanAmount}}</view>
		      </view>
		    </view>
		  </tn-list-cell>
		  <tn-list-cell>
		    <view class="list-icon-text">
		      <view class="list__left">
		        <view class="list__left__text">执行日利率</view>
		      </view>
		      <view class="list__right">
		        <view class="tn-text-sm tn-color-gray">{{loan.loan.dailyRate}}%</view>
		      </view>
		    </view>
		  </tn-list-cell>
		  <tn-list-cell>
		    <view class="list-icon-text">
		      <view class="list__left">
		        <view class="list__left__text">还款周期</view>
		      </view>
		      <view class="list__right">
		        <view class="tn-text-sm tn-color-gray">月</view>
		      </view>
		    </view>
		  </tn-list-cell>
		  <tn-list-cell>
		    <view class="list-icon-text">
		      <view class="list__left">
		        <view class="list__left__text">贷款期限</view>
		      </view>
		      <view class="list__right">
		        <view class="tn-text-sm tn-color-gray">{{loan.loan.loanMonth}}个月</view>
		      </view>
		    </view>
		  </tn-list-cell>
		  <tn-list-cell>
		    <view class="list-icon-text">
		      <view class="list__left">
		        <view class="list__left__text">贷款期限</view>
		      </view>
		      <view class="list__right">
		        <view class="tn-text-sm tn-color-gray">{{loan.loan.loanStart}}至{{loan.loan.loanEnd}}</view>
		      </view>
		    </view>
		  </tn-list-cell>
		  <tn-list-cell>
		    <view class="list-icon-text">
		      <view class="list__left">
		        <view class="list__left__text">抵押货物</view>
		      </view>
		      <view class="list__right">
		        <view class="tn-text-sm tn-color-gray">{{loan.instore.goodsName}}-{{loan.instore.goodsNum}}</view>
		      </view>
		    </view>
		  </tn-list-cell>
		  <tn-list-cell>
		    <view class="list-icon-text">
		      <view class="list__left">
		        <view class="list__left__text">货物保管仓库</view>
		      </view>
		      <view class="list__right">
		        <view class="tn-text-sm tn-color-gray">{{loan.instore.storeName}}</view>
		      </view>
		    </view>
		  </tn-list-cell>
		  <tn-list-cell>
		    <view class="list-icon-text">
		      <view class="list__left">
		        <view class="list__left__text">贷款机构</view>
		      </view>
		      <view class="list__right">
		        <view class="tn-text-sm tn-color-gray">xxx货物抵押贷款平台</view>
		      </view>
		    </view>
		  </tn-list-cell>
        </view>
		</demo-title>
      
      <view class="tn-padding-bottom-lg"></view>
	  <view class="tn-flex">
	    <view class="tn-flex-1 tn-padding tn-margin-xs " @click="tn(`/pages/loan/repayment_plan?loanAmount=${loan.loan.loanAmount}&loanMonth=${loan.loan.loanMonth}&loanStart=${loan.loan.loanStart}&dailyRate=${loan.loan.dailyRate}&repayMethod=${loan.loan.repayMethod}`)">
			<tn-button width="100%" size="sm" backgroundColor="#3668FC"  shadow >
			  <text class="tn-color-white tn-text-sm" >还款计划查询</text>
			</tn-button>
		</view>
	    <view class="tn-flex-1 tn-padding tn-margin-xs " @click="tn(`/pages/loan/repayment_detail?no=${loan.loan.loanNo}`)">
			<tn-button width="100%" size="sm" backgroundColor="#3668FC"  shadow >
			  <text class="tn-color-white tn-text-sm" >还款明细查询</text>
			</tn-button>
		</view>
	  </view>
    </view>

  </view>

</template>

<script>
  import demoTitle from '@/libs/components/demo-title.vue'
  import templatePageMixin from '@/libs/mixin/template_page_mixin.js'
  import {loanDetail} from '@/api/loan.js'
  export default {
    name: 'componentsList',
	mixins: [templatePageMixin],
    components: {demoTitle},
    data() {
      return {
		loan:{}
      }
    },
	onLoad(options) {
		this.detail(options.id)
	},
    watch: {

    },
    methods: {
		detail(id){
			loanDetail(id).then(res=>{
				this.loan = res
			})
		},
      // 跳转
      tn(e) {
      	uni.navigateTo({
      		url: e,
      	});
      },
    }
  }
</script>

<style lang="scss" scoped>
  
  .components-list {
    background-color: $tn-bg-gray-color;
    min-height: 100vh;
  }
  
  .custom-title {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 10rpx 20rpx;
  }
  
  .list__options {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  .list {
    &__left {
      display: flex;
      align-items: center;
      justify-content: flex-start;
      
      &__icon, &__image {
        margin-right: 18rpx;
      }
    }
    
    &__right {
      display: flex;
      align-items: center;
      justify-content: flex-end;
    }
  }
  
  .list-icon-text, .list-image-text {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  .list-image-text {
    .list {
      &__left {
        &__image {
          width: 20rpx;
          height: 20rpx;
        }
      }
    }
  }
  
  .message {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    
    &__left {
      width: 10%;
    }
    &__middle {
      width: 80%;
      padding-left: 20rpx;
      padding-right: 40rpx;
    }
    &__right {
      width: 10%;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
    }
    
    &__name {
      font-size: 32rpx;
      margin-bottom: 8rpx;
    }
    &__content {
      font-size: 26rpx;
      color: #838383;
    }
    &__tips {
      &__icon {
        font-size: 36rpx;
        color: #AAAAAA;
      }
    }
  }
</style>
